import request from './request';
import qs from 'qs';

// 登录
export const login = (data) => request.post('/mall-admin/admin/login', data)

// 获取当前登录用户信息
export const getUserInfo = (params) => request.get('/mall-admin/admin/info', { params })

// 获取用户列表
export const getAdminList = (params) => request.get('/mall-admin/admin/list', { params })

// 修改用户状态
export const updateUserStatus = (id, params) => request.post('/mall-admin/admin/updateStatus/' + id, null, { params });

// 获取指定用户的角色
export const getAdminRoleList = (id) => request.get('/mall-admin/admin/role/' + id);

// 获取所有角色
export const getRoleLists = () => request.get('/mall-admin/role/listAll');

// 获取所有角色
export const updateAdminRole = (data) => request.post('/mall-admin/admin/role/update', qs.stringify(data));

// 修改账号信息
export const updateAdminInfo = (id, data) => request.post('/mall-admin/admin/update/' + id, data);

// 添加账号信息
export const addAdminInfo = (data) => request.post('/mall-admin/admin/register', data);

// 删除账号
export const delAdminInfo = (id) => request.post('/mall-admin/admin/delete/' + id);

// 获取角色列表
export const getRoleList = (params) => request.get('/mall-admin/role/list', { params });

// 获取角色相关菜单
export const getRoleMenuById = (id) => request.get('/mall-admin/role/listMenu/' + id);

// 获取所有菜单
export const getAllMenus = () => request.get('/mall-admin/menu/treeList');

// 更新用户菜单
export const updateAllocMenu = (data) => request.post('/mall-admin/role/allocMenu', qs.stringify(data));

// 获取所有的资源
export const getAllResource = () => request.get('/mall-admin/resource/listAll');

// 获取角色对应的资源
export const getResourceByRoleId = (id) => request.get('/mall-admin/role/listResource/' + id);

// 获取角色资源分类
export const getResourceCate = () => request.get('/mall-admin/resourceCategory/listAll');

// 更新角色资源
export const updateRoleRes = (data) => request.post('/mall-admin/role/allocResource', qs.stringify(data));

// 更新角色资源
export const updateRoleInfo = (id, data) => request.post('/mall-admin/role/update/' + id, data);

// 更新角色资源
export const addRoleInfo = (data) => request.post('/mall-admin/role/create', data);

// 删除角色
export const delRoleLists = (data) => request.post('/mall-admin/role/delete', qs.stringify(data));

// 获取菜单
export const getMenuLists = (id, params) => request.get('/mall-admin/menu/list/' + id, { params });

// 获取菜单
export const updateMenuHidden = (id, params) => request.post('/mall-admin/menu/updateHidden/' + id, null, { params });

// 获取单个菜单详情
export const getMenuInfo = (id) => request.get('/mall-admin/menu/' + id);

// 修改单个菜单详情
export const updateMenuInfo = (id, data) => request.post('/mall-admin/menu/update/' + id, data);

// 修改单个菜单详情
export const createMenuInfo = (data) => request.post('/mall-admin/menu/create', data);

// 获取资源列表
export const getResourceList = (params) => request.get('/mall-admin/resource/list', { params });

// 获取订单列表
export const getOrderList = (params) => request.get('/mall-admin/order/list', { params });

// 批量关闭订单
export const closeOrder = (params) => request.post('/mall-admin/order/update/close', null, { params });

// 批量删除订单
export const deleteOrder = (params) => request.post('/mall-admin/order/delete', null, { params });

// 获取单个订单详情
export const getOrderDetail = (id) => request.get('/mall-admin/order/' + id);

// 修改订单收货人信息
export const updateReceiverInfo = (data) => request.post('/mall-admin/order/update/receiverInfo', data);

// 修改订单费用信息
export const updateMoneyInfo = (data) => request.post('/mall-admin/order/update/moneyInfo', data);

// 修改订单备注
export const updateOrderNote = (params) => request.post('/mall-admin/order/update/note', null, { params });

// 获取订单设置
export const getOrderSetting = (id) => request.get('/mall-admin/orderSetting/' + id);

// 修改订单设置
export const updateOrderSetting = (id, data) => request.post('/mall-admin/orderSetting/update/' + id, data);

// 获取退货申请列表
export const fetchReturnApplyList = (params) => request.get('/mall-admin/returnApply/list', { params });

// 删除退货申请
export const deleteApply = (params) => request.post('/mall-admin/returnApply/delete', null, { params });

// 更新订单退货申请状态
export const updateApplyStatus = (id, data) => request.post('/mall-admin/returnApply/update/status/' + id, data);

// 获取订单退货申请详情
export const getApplyDetail = (id) => request.get('/mall-admin/returnApply/' + id);

// 获取公司地址
export const getCompanyAddressList = () => request.get('/mall-admin/companyAddress/list');

// 退货原因列表
export const getReturnReasonList = (params) => request.get('/mall-admin/returnReason/list', { params });

// 删除退货原因
export const deleteReason = (params) => request.post('/mall-admin/returnReason/delete', null, { params });

// 更新退货原因状态
export const updateStatus = (params) => request.post('/mall-admin/returnReason/update/status', null, { params });

// 添加退货原因
export const addReason = (data) => request.post('/mall-admin/returnReason/create', data);

// 获取退货原因详情
export const getReasonDetail = (id) => request.get('/mall-admin/returnReason/' + id);

// 更新退货原因详情
export const updateReason = (id, data) => request.post('/mall-admin/returnReason/update/' + id, data);

// 获取秒杀活动列表
export const getFlashLists = (params) => request.get('/mall-admin/flash/list', { params });

// 更新秒杀活动状态
export const updateFlashStatus = (id, params) => request.post('/mall-admin/flash/update/status/' + id, null, { params });

// 删除秒杀活动
export const deleteFlash = (id) => request.post('/mall-admin/flash/delete/' + id);

// 创建秒杀活动
export const createFlash = (data) => request.post('/mall-admin/flash/create', data);

// 更新秒杀活动信息
export const updateFlash = (id, data) => request.post('/mall-admin/flash/update/' + id, data);

// 获取秒杀活动时段
export const getFlashSessionList = (params) => request.get('/mall-admin/flashSession/list', { params });

// 更新秒杀活动时段状态
export const updateFlashSessionStatus = (id, params) => request.post('/mall-admin/flashSession/update/status/' + id, null, { params });

// 删除秒杀活动时段
export const delFlashSession = (id) => request.post('/mall-admin/flashSession/delete/' + id);

// 添加秒杀活动时段
export const createFlashSession = (data) => request.post('/mall-admin/flashSession/create', data);

// 修改秒杀活动时段信息
export const updateFlashSession = (id, data) => request.post('/mall-admin/flashSession/update/' + id, data);

// 获取秒杀活动时段信息
export const getFlashSessionSelectList = (params) => request.get('/mall-admin/flashSession/selectList', { params });

// 获取秒杀商品列表
export const getFlashProductRelationList = (params) => request.get('/mall-admin/flashProductRelation/list', { params });

// 创建秒杀商品
export const createFlashProductRelation = (data) => request.post('/mall-admin/flashProductRelation/create', data);

// 删除秒杀商品
export const deleteFlashProductRelation = (id) => request.post('/mall-admin/flashProductRelation/delete/' + id);

// 更新秒杀商品
export const updateFlashProductRelation = (id, data) => request.post('/mall-admin/flashProductRelation/update/' + id, data);

// 获取商品列表
export const getProductList = (params) => request.get('/mall-admin/product/list', { params });

// 
export const updateDeleteProductStatus = (params) => request.post('/mall-admin/product/update/deleteStatus', null, { params });

// 
export const updateNewProductStatus = (params) => request.post('/mall-admin/product/update/newStatus', null, { params });

// 
export const updateRecommendStatus = (params) => request.post('/mall-admin/product/update/recommendStatus', null, { params });

// 
export const updatePublishStatus = (params) => request.post('/mall-admin/product/update/publishStatus', null, { params });

// 添加商品
export const createProduct = (data) => request.post('/mall-admin/product/create', data);

// 修改商品
export const updateProduct = (id, data) => request.post('/mall-admin/product/update/' + id, data);

// 获取商品详情
export const getProduct = (id) => request.get('/mall-admin/product/updateInfo/' + id);

// 获取sku库存
export const fetchSkuStockList = (id, params) => request.get('/mall-admin/sku/' + id, { params });

// 更新sku库存
export const updateSkuStockList = (id, data) => request.post('/mall-admin/sku/update/' + id, data);

// 根据分类获取属性
export const fetchProductAttrList = (id, params) => request.get('/mall-admin/productAttribute/list/' + id, { params });

// 获取简单得商品列表
export const getSimpleProductList = (params) => request.get('/mall-admin/product/simpleList', { params });

// 获取优惠券列表
export const getCouponList = (params) => request.get('/mall-admin/coupon/list', { params });

// 获取优惠券列表
export const deleteCoupon = (id) => request.post('/mall-admin/coupon/delete/' + id);

// 添加优惠券
export const createCoupon = (data) => request.post('/mall-admin/coupon/create', data);

// 获取优惠券详情
export const getCoupon = (id) => request.get('/mall-admin/coupon/' + id);

// 更新优惠券详情
export const updateCoupon = (id, data) => request.post('/mall-admin/coupon/update/' + id, data);

// 获取商品分类
export const fetchProListWithChildren = () => request.get('/mall-admin/productCategory/list/withChildren');

// 
export const fetchProCateList = (id, params) => request.get('/mall-admin/productCategory/list/' + id, { params });

// 
export const deleteProductCate = (id) => request.post('/mall-admin/productCategory/delete/' + id);

// 
export const updateProCateShowStatus = (data) => request.post('/mall-admin/productCategory/update/showStatus', data);

// 
export const createProductCate = (data) => request.post('/mall-admin/productCategory/create', data);

// 
export const updateProductCate = (id, data) => request.post('/mall-admin/productCategory/update/' + id, data);

// 
export const deleteProductAttr = (data) => request.post('/mall-admin/productAttribute/delete', data);

// 
export const fetchCateListWithAttr = (params) => request.get('/mall-admin/productAttribute/category/list/withAttr', { params });

// 
export const getProductAttrInfo = (id) => request.get('/mall-admin/productAttribute/attrInfo/' + id);

// 
export const getProductCate = (id) => request.get('/mall-admin/productCategory/' + id);

// 
export const updateProCateNavStatus = (data) => request.post('/mall-admin/productCategory/update/navStatus', data);

// 
export const fetchSubjectList = () => request.get('/mall-admin/subject/listAll');

// 
export const fetchPrefrenceAreaList = () => request.get('/mall-admin/prefrenceArea/listAll');

// 
export const fetchMemberLevelList = (params) => request.get('/mall-admin/memberLevel/list', { params });

// 
export const createProductAttrCate = (data) => request.post('/mall-admin/productAttribute/category/create', data);

// 
export const deleteProductAttrCate = (id) => request.get('/mall-admin/productAttribute/category/delete/' + id);

// 
export const createProductAttr = (data) => request.post('/mall-admin/productAttribute/create', data);

// 
export const getProductAttr = () => request.get('/mall-admin/productAttribute/' + id);

// 
export const updateProductAttrCate = (id, data) => request.post('/mall-admin/productAttribute/category/update/' + id, data);

// 
export const updateProductAttr = (id, data) => request.post('/mall-admin/productAttribute/update/' + id, data);

// 
export const updateBrandShowStatus = (data) => request.post('/mall-admin/brand/update/showStatus', data);

// 
export const updateBrandFactoryStatus = (data) => request.post('/mall-admin/brand/update/factoryStatus', data);

// 
export const deleteBrand = (id) => request.get('/mall-admin/brand/delete/' + id);

// 
export const fetchProductAttrCateList = (params) => request.get('/mall-admin/productAttribute/category/list', { params });

// 
export const createBrand = (data) => request.post('/mall-admin/brand/create', data);

// 
export const getBrand = (id) => request.get('/mall-admin/brand/' + id);

// 
export const updateBrand = (id, data) => request.post('/mall-admin/brand/update/' + id, data);

// 获取历史优惠券
export const getCouponHistoryList = (params) => request.get('/mall-admin/couponHistory/list', { params });

// 获取推荐品牌列表
export const getHomeBrandList = (params) => request.get('/mall-admin/home/brand/list', { params });

// 更新推荐品牌
export const updateRecommendBrandStatus = (data) => request.post('/mall-admin/home/brand/update/recommendStatus', data);

// 删除推荐品牌
export const deleteHomeBrand = (data) => request.post('/mall-admin/home/brand/delete', data);

// 添加推荐品牌
export const createHomeBrand = (data) => request.post('/mall-admin/home/brand/create', data);

// 修改推荐品牌排序
export const updateHomeBrandSort = (params) => request.post('/mall-admin/home/brand/update/sort/' + params.id, null, { params });

// 获取品牌列表
export const getBrandList = (params) => request.get('/mall-admin/brand/list', { params });

// 获取新产品列表
export const getHomeNewProList = (params) => request.get('/mall-admin/home/newProduct/list', { params });

// 更新新产品推荐状态
export const updateHomeNewRecStatus = (data) => request.post('/mall-admin/home/newProduct/update/recommendStatus', data);

// 删除新产品
export const delHomeNewRecPro = (data) => request.post('/mall-admin/home/newProduct/delete', data);

// 添加新产品推荐
export const createHomeNewRecPro = (data) => request.post('/mall-admin/home/newProduct/create', data);

// 更新新产品推荐排序
export const updateHomeNewRecProSort = (params) => request.post('/mall-admin/home/newProduct/update/sort/' + params.id, null, { params });

// 获取人气产品推荐列表
export const getRecomProductList = (params) => request.get('/mall-admin/home/recommendProduct/list', { params });

// 更新人气产品推荐状态
export const updateRecomProductStatus = (data) => request.post('/mall-admin/home/recommendProduct/update/recommendStatus', data);

// 删除人气产品推荐
export const delRecomProduct = (data) => request.post('/mall-admin/home/recommendProduct/delete', data);

// 添加人气产品推荐
export const createRecomProduct = (data) => request.post('/mall-admin/home/recommendProduct/create', data);

// 更新人气产品推荐排序
export const updateRecomProductSort = (params) => request.post('/mall-admin/home/recommendProduct/update/sort/' + params.id, null, { params });

// 获取专题推荐列表
export const getRecoSubjectList = (params) => request.get('/mall-admin/home/recommendSubject/list', { params });

// 更新专题推荐状态
export const updateRecoSubjectStatus = (data) => request.post('/mall-admin/home/recommendSubject/update/recommendStatus', data);

// 删除专题推荐
export const delRecoSubject = (data) => request.post('/mall-admin/home/recommendSubject/delete', data);

// 添加专题推荐
export const createRecoSubject = (data) => request.post('/mall-admin/home/recommendSubject/create', data);

// 修改专题推荐
export const updateRecoSubject = (params) => request.post('/mall-admin/home/recommendSubject/update/sort/' + params.id, null, { params });

// 专题列表
export const getSubjectList = (params) => request.get('/mall-admin/subject/list', { params });

// 获取广告列表
export const getHomeAdLists = (params) => request.get('/mall-admin/home/advertise/list', { params });

// 修改广告状态
export const updateHomeAdStatus = (id, params) => request.post('/mall-admin/home/advertise/update/status/' + id, null, { params });

// 删除首页广告
export const delHomeAd = (data) => request.post('/mall-admin/home/advertise/delete', data);

// 添加首页广告
export const addHomeAd = (data) => request.post('/mall-admin/home/advertise/create', data);

// 获取首页广告
export const getHomeAdvertise = (id) => request.get('/mall-admin/home/advertise/' + id);

// 获取首页广告
export const updateHomeAdvertise = (id, data) => request.get('/mall-admin/home/advertise/update/' + id, data);

//
export const getStatData = (params) => request.get('http://kumanxuan1.f3322.net:8360/admin/stat', {
    params
});

export const uploadGoodPic = (data) => request.post('http://kumanxuan1.f3322.net:8360/admin/upload/goodNewPic', data);

